Skip to content

feat(transform): echo reasoning_content for DeepSeek thinking mode#21

Merged
mydisha merged 3 commits into
mainfrom
fix/deepseek-error-thinking-mode
Jun 24, 2026
Merged

feat(transform): echo reasoning_content for DeepSeek thinking mode#21
mydisha merged 3 commits into
mainfrom
fix/deepseek-error-thinking-mode

Conversation

@mydisha

@mydisha mydisha commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • echo structured thinking as reasoning_content in OpenAI-compatible responses
  • inject placeholder reasoning_content for DeepSeek follow-up assistant messages that lack real reasoning
  • detect DeepSeek by provider ID or model name for OpenAI-compatible aggregators
  • add tests for streaming, non-streaming, and request rendering behavior

Tests

  • cd backend && go test ./internal/transform

mydisha added 3 commits June 21, 2026 10:28
DeepSeek thinking-capable models (including those served via OpenAI-compatible
aggregators like OpenRouter, SiliconFlow, and Fireworks) reject follow-up turns
with a 400 when assistant messages omit reasoning_content.

To fix this:
- Add requiresReasoningEcho to detect DeepSeek by provider ID or model name
- Inject a placeholder reasoning_content on assistant messages lacking real
  reasoning during request rendering for reasoning-mode providers
- Surface structured thinking as reasoning_content in rendered responses so
  clients can replay it on subsequent turns
- Add tests covering reasoning rendering and injection behavior

Messages carrying genuine reasoning are left untouched to preserve the real
chain-of-thought.
Update DeepSeek catalog rates and model pricing.
Add DeepSeek v4 capabilities and lookup/pricing tests.
DeepSeek requires reasoning_content on all assistant turns, while Kimi
models only need it on turns carrying tool_calls. Replace the boolean
injection flag with a reasoningScope enum (none/all/toolCalls) so each
provider gets the correct behavior. Extract isDeepSeekTarget to gate
DeepSeek-specific fixes separately from reasoning echo detection.
@mydisha mydisha merged commit f9e9ece into main Jun 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant